package com.levy.contronller.javaWeb.threadConcurrence.threadApiTest;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by levy on 2019/7/9.
 */
public class TestMain3 {



    @Test
    public void test() throws InterruptedException {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("t1");
            }
        });
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("t2");
            }
        });
        Thread t3 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("t3");
            }
        });

        ExecutorService es = Executors.newSingleThreadExecutor();
        es.submit(t1);
        es.submit(t2);
        es.submit(t3);
        es.shutdown();



//        t1.start();
//        t1.join();
//        t2.start();
//        t2.join();
//        t3.start();
//        t3.join();


    }


    public static void main(String[] args) throws ClassNotFoundException {
//        List<Object> list = Collections.synchronizedList(new ArrayList<>());
//        list.add("aa");
//        list.add("55");
//        list.subList(0,2);
//
//        ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
//        // segment
//        CopyOnWriteArrayList list1 = new CopyOnWriteArrayList();

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Class<?> aClass = cl.loadClass("org.apache.lucene.analysis.ReusableAnalyzerBase");
        System.out.println(aClass);


    }
}
